﻿/*
-----------------------------------
    Rodeo Game Engine
    Rodeo IO Module
    Log.h - header file
    Copyright(c) Marcin Goryca
-----------------------------------
*/
#ifndef RODEO_IO_LOG_H_
#define RODEO_IO_LOG_H_

#ifndef RODEO_CORE_ERROR_H_
#include "core\error.h"
#endif

namespace rodeoio
{
class Log
{
public:
    Log()
        :hfile_(NULL),
         filename_(""),
         mode_(""),
         fileopen_(false)
    {}

    ~Log()
    {
        fileopen_ = false;
        mode_ = "";
        filename_ = "";
        hfile_ = NULL;
    }

    //Copy constructor
    Log(const Log& log);

    bool open(const char* filename);
    void write(const char* string);

private:
    void close();
    void update(const char* filename, const char* buffer);
    void save(const char* filename);
    void load(const char* filename);

//==== MEMBERS ====//
    HANDLE hfile_;
    const char* filename_;
    const char* mode_;

    bool fileopen_;
};
}    //end of rodeoio namespace
#endif	//RODEO_IO_LOG_H_